#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>

int main()
{
    pid_t id = fork();
    if(id == 0)
    {
        int cnt = 5;
        while(cnt)
        {
            cnt--;
            printf("child process,pid: %d, ppid:%d\n",getpid(),getppid());
            sleep(1);
        }
        
        exit(0);
    }
    // father
    int cnt = 10;
    while(cnt)
    {
        cnt--;
        printf("father process,pid: %d, ppid:%d\n",getpid(),getppid());
        sleep(1);
    }

    wait(NULL);
    printf("father wait child done...\n");
    sleep(5);

    return 0;
}